/*
 * @file TFinderRpcImplementation.java
 * UMLSynch plugin for Eclipse
 * http://umlsynch.googlecode.com
 *
 * @author Evgeny Alexeyev
 * Copyright 2008-2010
 * Licensed under the EPL - v1.0
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package com.googlecode.umlsynch.eclipse.rpc;

import com.googlecode.umlsynch.EclipseSearchVeiwWrapper.EclipseSeachQuery;
import com.googlecode.umlsynch.eclipse.astutils.ASTUtils;
import com.googlecode.umlsynch.eclipse.astutils.TranslationUnitUtils;
import com.googlecode.umlsynch.rpc.IFinderRpc;
import com.googlecode.umlsynch.rpc.TClassDescriptor;
import com.googlecode.umlsynch.rpc.TFileDescriptor;
import com.googlecode.umlsynch.rpc.TSearchQueryDescriptor;
import com.googlecode.umlsynch.rpc.base.IDebug;
import com.googlecode.umlsynch.rpc.base.TDebug;

/**
 * 
 */
public class TFinderRpcImplementation implements IFinderRpc {

	private TDebug debug;
//	private ASTUtils astutils = ASTUtils.instance();;
	private TranslationUnitUtils tuUtils = TranslationUnitUtils.GetInstance();

	public TFinderRpcImplementation(IDebug dbg) {
		debug = new TDebug(dbg);
	}
	/* (non-Javadoc)
	 * @see com.googlecode.umlsynch.rpc.IFinderRpc#FindClassByName(com.googlecode.umlsynch.rpc.TFileDescriptor[], java.lang.String)
	 */
	@Override
	public TClassDescriptor[] FindClassByName(TFileDescriptor[] searchPaths,
			String searchNamePattern) {
		return null;
	}

	/* (non-Javadoc)
	 * @see com.googlecode.umlsynch.rpc.IFinderRpc#FindValueByName(com.googlecode.umlsynch.rpc.TFileDescriptor, java.lang.String)
	 */
	@Override
	public void FindValueByName(TFileDescriptor sourceFile, String namePattern) {
				
	}

	/* (non-Javadoc)
	 * @see com.googlecode.umlsynch.rpc.IFinderRpc#FindValueByType(com.googlecode.umlsynch.rpc.TFileDescriptor, java.lang.String)
	 */
	@Override
	public void FindValueByType(TFileDescriptor sourceFile, String namePattern) {
		
	}

	/* (non-Javadoc)
	 * @see com.googlecode.umlsynch.rpc.IFinderRpc#SearchTextPattern(com.googlecode.umlsynch.rpc.TSearchQueryDescriptor)
	 * 
	 * This is common Eclipse functionality 
	 * there is no needs to overwrite it in UMLSynchExtension
	 */
	@Override
	public void SearchTextPattern(TSearchQueryDescriptor desc) {
		debug.Note("Searching: " + desc.projectName +
				"  " + desc.text + "   Type:" + desc.type);
		// Formalization of query
		EclipseSeachQuery sq = new EclipseSeachQuery(desc);
		
		// Start search
		sq.performAction();			
	}
}
